<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="javabean.JDBCBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>

<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/bootstrap-table.css" rel="stylesheet">
<link rel="stylesheet" href="../public/layui/css/layui.css">
<link rel="stylesheet" href="css/qrm-pinming.css">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<script src="../public/layui/layui.js"></script>
	<style>
		.layui-table,.layui-table-view{
			margin: 0 0px;
		}
		.layui-form-select dl dd.layui-this { background-color: #01AAED; }
	</style>
	
</head>
<body>
	<jsp:useBean id="createorder" scope="session" class="javabean.JDBCBean"></jsp:useBean>

	<%
//		ResultSet librarySet = null;
//		ResultSet bookSortSet = null;
//		// 获取图书馆列表
//		JDBCBean db2 = new JDBCBean();
//		String librarySql = "select * from library";
//		librarySet = db2.executeQuery( librarySql );
//		// 获取书籍分类
//		JDBCBean db3 = new JDBCBean();
//		String bookSortSql = "select * from book_sort";
//		bookSortSet = db3.executeQuery( bookSortSql );
//		String apikey="12469.fcd2ac4e9b8099d51e8db251737d84b8.ed524086f8e7ec7c9d0aaa5c9c3dd350";
////    String isbn = "9787020024759";
		int i=0;
		char j='a';

	%>
	<script src="../public/layui/layui.js" charset="utf-8"></script>
	<!-- 表单 -->
	<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
	<form class="layui-form   layui-form-pane" action="" style="width: 400px">
		<input type="id" name="id" value="3" class="layui-hide">
		<div class="layui-form-item">
			<label class="layui-form-label">寄件人姓名</label>
			<div class="layui-input-block">
				<input type="text" id="uid"  name="uid" required="" lay-verify="required" placeholder="输入寄件人姓名" autocomplete="off" class="layui-input" style="width: 300px" readonly>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">寄件区域</label>
			<div class="layui-input-block">
				<select name="loc" lay-verify="required">
					<option value=""></option>
					<% for(;i<4;i++,j++){ %>
					<option value=<%=j %>  ><%=j %></option>
					<%} %>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">收件人姓名</label>
			<div class="layui-input-block">
				<input type="text" id="rid" name="rid" required  lay-verify="required" placeholder="输入收件人姓名" autocomplete="off" class="layui-input"style="width: 300px">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">目的区域</label>
			<div class="layui-input-block">
				<select name="des" lay-verify="required">
					<option value=""></option>
					<% for(i=0,j='a';i<4;i++,j++){ %>
					<option value=<%=j %>  ><%=j %></option>
					<%} %>
				</select>
			</div>
		</div>
<%--			<div class="layui-form-item">--%>
<%--				<label class="layui-form-label">State</label>--%>
<%--				<div class="layui-input-block">--%>
<%--					<input type="radio" name="status" value="1" title="可借" checked="checked"><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><div>可借</div></div>--%>
<%--					<input type="radio" name="status" value="0" title="不可借"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><div>不可借</div></div>--%>
<%--				</div>--%>
<%--			</div>--%>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">备注</label>
				<div class="layui-input-block">
					<textarea class="layui-textarea" id="description" name="description" lay-verify="content" id="LAY_demo_editor"></textarea>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="bookForm">立即下单</button>
				</div>
			</div>
	</form>
	<script>
		$(function(){

<%
                                    Object user=session.getAttribute("user");
									String uid =user.toString();
 %>
			document.getElementById("uid").value="<%=uid%>";
			// var str =document.getElementById("ISBN");
			// var isbn = document.createAttribute("ISBN");
			// isbn.value=st
		})
	</script>
	<script>


		layui.use(['form', 'layedit', 'jquery'], function(){
			//layer.closeAll();
			$ = layui.jquery;
			var form = layui.form
					,layer = layui.layer
					,layedit = layui.layedit;
			form.on('submit(bookForm)', function(data){
				$.ajax({
					url: './ordercreate',
					method: 'post',
					data: data.field, //JSON.stringify(data.field),
					dataType: 'JSON',
					success: function(data){
						if(data.code == "0"){
							layer.msg("添加成功",{
								icon: 6,
								time: 500
							}, function(){
								window.location.reload()
							})
						}else{
							layer.msg("添加失败");
						}
					}
				})


				return false;
			});
		});

	</script>
</body>
</html>